#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include "myobject.h"
#include "myclass.h"

int main(int argc, char *argv[])
{
    QGuiApplication app(argc, argv);

    qmlRegisterType<MyClass>("CppModule", 1, 0, "MyClass");
    QQmlApplicationEngine engine;
    MyObject myObject;
    engine.rootContext()->setContextProperty("myObject", &myObject);
    QObject::connect(
        &engine,
        &QQmlApplicationEngine::objectCreationFailed,
        &app,
        []() { QCoreApplication::exit(-1); },
        Qt::QueuedConnection);
    engine.loadFromModule("QuickDemo", "Main");

    return app.exec();
}
